package com.ywt.cda.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.supply.network.melody.common.util.ArrayUtil;

public enum FunctionsEnum
{
	CDA("综合决策分析系统", "02"),
	IMPORT_ANALYSIS("进口深度分析", "0201"),
	EXPORT_ANALYSIS("出口深度分析", "0202"),
	IMPORT_SHOPS("电商决策分析", "020101"),
	IMPORT_THESHOP("企业定向分析", "020102"),
	IMPORT_GOODS("商品分析", "020103"),
	IMPORT_THEGOOD("商品定向分析", "020104"),
	IMPORT_THEAREA("地域分析", "020108"),
	IMPORT_AREA("地域定向分析", "020105"),
	IMPORT_CUNSUMERS("消费群体分析", "020106"),
	IMPORT_PORTS("通关口岸分析", "020107"),
	EXPORT_SHOPS("电商决策分析", "020201"),
	EXPORT_THESHOP("企业定向分析", "020202"),
	EXPORT_GOODS("商品分析", "020203"),
	EXPORT_THEGOOD("商品定向分析", "020204"),
	EXPORT_AREA("地域分析", "020205"),
	EXPORT_CUNSUMERS("消费群体分析", "020206"),
	EXPORT_PORTS("通关口岸分析", "020207");
	
	private String name;
	private String code;
	
	public static Map<String, FunctionsEnum> map = new HashMap<String, FunctionsEnum>();
	
	static {
		for(FunctionsEnum e : FunctionsEnum.values()) {
			map.put(e.getCode(), e);
		}
	}
	
	public String getName()
	{
		return name;
	}
	public void setName(String name)
	{
		this.name = name;
	}
	public String getCode()
	{
		return code;
	}
	public void setCode(String code)
	{
		this.code = code;
	}
	
	FunctionsEnum(String name, String code) {
		this.name = name;
		this.code = code;
	}
	
	public static List<FunctionsEnum> getFunctions(List<String> funs)
	{
		List<FunctionsEnum> list = null;
		if(funs != null)
		{
			list = new ArrayList<FunctionsEnum>();
			for (String func : funs) {
				if(StringUtils.isNotEmpty(func))
				{
					if(map.get(func) != null) {
						list.add(map.get(func));
					}
				}
			}
		}
		return list;
	}
}
